\section{Source/Sort.h}


\begin{footnotesize}\begin{alltt}
00001 \textcolor{preprocessor}{#ifndef SORT\_HEADER}
00002 \textcolor{preprocessor}{}\textcolor{preprocessor}{#define SORT\_HEADER}
00003 \textcolor{preprocessor}{}\textcolor{comment}{/*}
00004 \textcolor{comment}{    Algorithms:}
00005 \textcolor{comment}{        Sort\_Quick -    Very quick algorithm, however}
00006 \textcolor{comment}{                                worst case is slower than heap}
00007 \textcolor{comment}{                                sort's worst case.}
00008 \textcolor{comment}{        Sort\_Bubble -   Simple but very slow algorithm,}
00009 \textcolor{comment}{                                especially for larger arrays.}
00010 \textcolor{comment}{        Sort\_Heap -         Better worst case than quick}
00011 \textcolor{comment}{                                sort. However, is often slower}
00012 \textcolor{comment}{                                than quick sort in practice.}
00013 \textcolor{comment}{        Sort\_Cocktail - An improvement over bubble}
00014 \textcolor{comment}{                                sort. However, still not as}
00015 \textcolor{comment}{                                good as other algorithms.}
00016 \textcolor{comment}{        Sort\_Dan -      My (Daniel White's) attempt at}
00017 \textcolor{comment}{                                a sorting algorithm.}
00018 \textcolor{comment}{        Sort\_RapidX -   Optimal sorting for small arrays}
00019 \textcolor{comment}{                                (implemented for X=2,3,4).}
00020 \textcolor{comment}{        }
00021 \textcolor{comment}{    Speeds (without -O3):}
00022 \textcolor{comment}{        Algorithm               10x10^7 100x10^6    1000x10^4   10^4x100}
00023 \textcolor{comment}{        Quick sort          9s          13s             2s              0s}
00024 \textcolor{comment}{        c qsort                 14s         18s             2s              1s}
00025 \textcolor{comment}{        Dan sort                8s          24s             17s             15s}
00026 \textcolor{comment}{        Heap sort               9s          27s             20s             18s}
00027 \textcolor{comment}{        Insert sort         11s         29s             22s             26s}
00028 \textcolor{comment}{        Bucket sort         11s         33s             25s             26s}
00029 \textcolor{comment}{        Cocktail sort           13s         58s             52s             54s}
00030 \textcolor{comment}{        Bubble sort         12s         84s             87s             95s}
00031 \textcolor{comment}{        }
00032 \textcolor{comment}{    Speeds (with -O3):}
00033 \textcolor{comment}{        Algorithm               10x10^7 100x10^6    1000x10^4   10^4x100}
00034 \textcolor{comment}{        Quick sort          5s          8s              1s              0s}
00035 \textcolor{comment}{        c qsort                 13s         18s             2s              0s}
00036 \textcolor{comment}{        Dan sort                5s          12s             5s              4s}
00037 \textcolor{comment}{        Insert sort         6s          13s             8s              8s}
00038 \textcolor{comment}{        Heap sort               7s          18s             11s             10s}
00039 \textcolor{comment}{        Bucket sort         6s          18s             12s             13s}
00040 \textcolor{comment}{        Cocktail sort           7s          22s             18s             17s}
00041 \textcolor{comment}{        Bubble sort         7s          34s             30s             30s}
00042 \textcolor{comment}{*/}
00043 
00044 \textcolor{comment}{/* Prototypes */}
00045 \textcolor{keywordtype}{void} Sort\_Bucket(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00046 \textcolor{keywordtype}{void} Sort\_Dan(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00047 \textcolor{keywordtype}{void} Sort\_Quick(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00048 \textcolor{keywordtype}{void} Sort\_Bubble(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00049 \textcolor{keywordtype}{void} Sort\_Heap(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00050 \textcolor{keywordtype}{void} Sort\_Cocktail(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00051 \textcolor{keywordtype}{void} Sort\_Insert(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset, \textcolor{keywordtype}{int} Length);
00052 \textcolor{keyword}{inline} \textcolor{keywordtype}{void} Sort\_Rapid2(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset);
00053 \textcolor{keyword}{inline} \textcolor{keywordtype}{void} Sort\_Rapid3(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset);
00054 \textcolor{keyword}{inline} \textcolor{keywordtype}{void} Sort\_Rapid4(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset);
00055 \textcolor{keyword}{inline} \textcolor{keywordtype}{void} Sort\_Rapid5(\textcolor{keywordtype}{int} *Array, \textcolor{keywordtype}{int} Offset);
00056 
00057 \textcolor{preprocessor}{#endif}
\end{alltt}\end{footnotesize}
